﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SDT.Site.ViewModels.ArticleListViewModel>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<%if (Model.Articles != null && Model.Articles.Count > 0)
     {
         var first = Model.Articles[0]; %> 
<div class="bor_cor content mar_t" style="overflow:hidden;">
    <div class="heading_bar">
        <div class="heading_bar_tit">
            <a href="/article/list/<%=Model.Category.ID %>"><%=Html.Encode(Model.Category.Name) %></a>
        </div>    
    </div>
    <div class="xtt"><a href="/article/list/<%=Model.Category.ID %>">Xem tất cả</a></div>
    <div class="heading_bar_line"></div>
    <div class="tt_pad ">
        <div class="tt_img">
            <a href="/article/details/<%=first.ID %>/<%=Html.ToUrlFriendly(first.Title)%>">
                <% string imgPath = (first.ImagePath != null && first.ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(first.ID, 200, 138, first.ImagePath, Model.ImagePath, Model.RootImageUrl) : SDT.Lib.Common.Globals.DefaultLogo; %>
                <img src="<%=imgPath %>" title="<%=first.Title %>" alt="<%=first.Title %>" class="bor_img" width="200" height="138" style="overflow:hidden"/>
            </a>
        </div>        
        <div class="tt_cnt">
            <h2><a href="/article/details/<%=first.ID %>/<%=Html.ToUrlFriendly(first.Title)%>" class="link_org"><%=Html.Encode(first.Title) %></a></h2>
            <div class="datetime"><%=first.AddDate.ToString("HH:mm") %>&nbsp; | <%=first.AddDate.ToString("dd/MM/yyyy") %></div>
            <div>
                <%=Html.Encode(first.Summary) %>
            </div>
        </div>
    
        <div class="clear"></div>
        <div style="display:block; overflow:hidden">       
            <div class="tt_2col_l pad">        
                <%var total = Model.Articles.Count - 1;
                  int totaRight = total / 2;
                  int totalLeft = total -totaRight;
                  if (totalLeft > 0)
                { %>
       	          <%for (int i = 1; i < totalLeft+1; i++)
                    {
                        string imgPath1 = (Model.Articles[i].ImagePath != null && Model.Articles[i].ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(Model.Articles[i].ID, 70, 56, Model.Articles[i].ImagePath, Model.ImagePath, Model.RootImageUrl) : SDT.Lib.Common.Globals.DefaultLogo;
                     %>
       	                <div class="tt_2col_img">
       	                    <a href="/article/details/<%=Model.Articles[i].ID %>/<%=Html.ToUrlFriendly(Model.Articles[i].Title)%>">
                                <img class="bor_img" src="<%=imgPath1 %>" title="<%=Model.Articles[i].Title %>" alt="<%=Model.Articles[i].Title %>" width="70" height="56" />
                            </a>
       	                </div>
       	                <div class="tt_2col_cnt">
       	                    <a href="/article/details/<%=Model.Articles[i].ID %>/<%=Html.ToUrlFriendly(Model.Articles[i].Title)%>"><%=Html.Encode(Model.Articles[i].Title)%></a>
       	                </div>
       	                <div class="clear"></div>            
                   <%} %>
              <%} %>
            </div>
            <div class="tt_2col_r pad">
                <%if (totaRight > 0)
                { %>
       	          <%for (int i = 1 + totalLeft; i < Model.Articles.Count; i++)
                    {
                         string imgPath1 = (Model.Articles[i].ImagePath != null && Model.Articles[i].ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(Model.Articles[i].ID, 70, 56, Model.Articles[i].ImagePath, Model.ImagePath, Model.RootImageUrl) : SDT.Lib.Common.Globals.DefaultLogo;
                     %>
       	                <div class="tt_2col_img">
       	                    <a href="/article/details/<%=Model.Articles[i].ID %>/<%=Html.ToUrlFriendly(Model.Articles[i].Title)%>">
                                <img class="bor_img" src="<%=imgPath1 %>" title="<%=Model.Articles[i].Title %>" alt="<%=Model.Articles[i].Title %>" width="70" height="56" />
                            </a>
       	                </div>
       	                <div class="tt_2col_cnt">
       	                    <a href="/article/details/<%=Model.Articles[i].ID %>/<%=Html.ToUrlFriendly(Model.Articles[i].Title)%>"><%=Html.Encode(Model.Articles[i].Title)%></a>
       	                </div>
       	                <div class="clear"></div>                    
                   <%} %>
              <%} %>
            </div>
            <div class="clear"></div>
        </div>
    </div>
</div>
<%} %>
<div class="clear"></div>
